package models;

/**
 * Created by yangxianming on 2019/4/8.
 * 分页算法
 */
public class Page {
    public static Integer getPageCount(int countX, int everyPageY){
        //计算出总数据在每页多少的情况下，一共有几页
        int r = countX/everyPageY;
        int m = countX%everyPageY;
        int countPage;
        if (countX > 0 && countX < everyPageY){
            countPage = 1;
        }else {
            countPage = r>0 ? (m>0?r+1:r) : 0;
        }
        return countPage;
    }
}
